Import("env")


pxds = [
    File(x)
    for x in (
        "__init__.py",  # Not really a .pxd but still needed
        "conversion.pxd",
        "internal.pxd",
        "gdapi.pxd",
        "gdnative_api_struct.pxd",
    )
]
env.AppendUnique(CYTHON_DEPS=pxds)
env.Install("$DIST_SITE_PACKAGES/godot/_hazmat", pxds)


### Generate godot api .h -> gdnative_api_struct.pxd ###


gdnative_api_struct_pxd = env.Command(
    target="gdnative_api_struct.pxd",
    source=["#/generation/generate_gdnative_api_struct.py", env["godot_headers"]],
    action="python ${SOURCES[0]} --input ${SOURCES[1]} --output ${TARGET}",
)


### Cython modules ###


env.Install("$DIST_SITE_PACKAGES/godot/_hazmat", env.CythonModule("conversion", "conversion.pyx"))

env.Install("$DIST_SITE_PACKAGES/godot/_hazmat", env.CythonModule("internal", "internal.pyx"))
